<template>
	<div v-show="showPage">
		<div style="border-bottom: 1px solid #ddd;">
			<h3>基本信息</h3>
		</div>
		<el-row style="margin-top: 10px;">
			<el-col :span="8" class="field-label">编码</el-col>
			<el-col :span="16">
				<el-input v-model="pageCode" size="mini"></el-input>
			</el-col>
		</el-row>
		<el-row style="margin-top: 10px;">
			<el-col :span="8" class="field-label">名称</el-col>
			<el-col :span="16">
				<el-input v-model="name" size="mini"></el-input>
			</el-col>
		</el-row>
		<el-row style="margin-top: 10px;">
			<el-col :span="8" class="field-label">描述</el-col>
			<el-col :span="16">
				<el-input v-model="description" size="mini" type="textarea"></el-input>
			</el-col>
		</el-row>
	</div>
</template>

<script>
	import shareData from '@/utils/shareData.js';
	export default {
		name: "PageBaseInfoPage",
		props: ["scope"],
		data() {
			return {
				showPage: false,
				pageCode: "",
				name: "",
				description: "",
			}
		},
		methods: {
			setVisible(visible) {
				this.showPage = visible;
				if (visible) {
					var device = this.scope.deviceSelectPage.device;
					if (device == "pc") {
						device = "";
					} else {
						device += "_"
					}
					this.pageCode = device + this.scope.dataSourceSelectPage.tableName + "_" +
						this.scope.pageTypeSelectPage.pageType;
					var suffix;
					for (var i = 0; i < shareData.pageTypeList.length; i++) {
						if (shareData.pageTypeList[i].value == this.scope.pageTypeSelectPage.pageType) {
							suffix = shareData.pageTypeList[i].name;
							break;
						}
					}
					if (this.scope.pageTypeSelectPage.pageType == "dashboardview") {
						this.pageCode = device + "dashboardview";
						this.name = suffix;
						if (this.scope["deviceSelectPage"]["device"] == "mobile") {
							this.name = "移动端" + this.name;
						}
					} else {
						this.name = this.scope.dataSourceSelectPage.name + suffix;
						if (this.scope["deviceSelectPage"]["device"] == "mobile") {
							this.name = "移动端" + this.name;
						}
					}
				}
			},
			getReturnData() {
				return {
					"pageCode": this.pageCode,
					"name": this.name,
					"description": this.description
				};
			},
			getPreviousPage() {
				if (this.scope["pageTypeSelectPage"]["pageType"] == "dashboardview") {
					return "pageTypeSelectPage";
				}
				return "dataSourceSelectPage";
			},
			getNextPage() {
				return "tableFieldSelectPage";
			},
			isCompletedPage() {
				if (this.scope["deviceSelectPage"]["device"] == "pc" &&
					this.scope["dataSourceSelectPage"]["treeTable"] == true && this.scope["pageTypeSelectPage"][
					"pageType"] == "searchview") {
					return true;
				}
				if (this.scope["pageTypeSelectPage"]["pageType"] == "dashboardview") {
					return true;
				}
				return false;
			}
		},
	}
</script>

<style>
</style>
